#include "StdAfx.h"
#include "Torus.h"


CTorus::CTorus(void)
{
}

CTorus::CTorus(CPoint3D pBegin, CPoint3D pEnd)
{
	m_Begin = pBegin;
	m_End = pEnd;
}

CTorus::~CTorus(void)
{
}

void CTorus::Draw()
{
	if (selected == true)
	{
		glMaterialfv(GL_FRONT, GL_AMBIENT, blue);
	}
	else 
	{
		glMaterialfv(GL_FRONT, GL_AMBIENT, black);
	}
	glPushMatrix();
	float size = m_End.getX() - m_Begin.getX();
	glTranslatef((m_Begin.getX() + m_End.getX()) / 2 ,(m_Begin.getY() + m_End.getY()) / 2, (m_Begin.getZ() + m_End.getZ()) / 2);
	//glRotatef(75, 1, 0 , 0);
	glRotatef(rotateX, 1.0, 0.0, 0.0);
	glRotatef(rotateY, 0.0, 1.0, 0.0);
	glRotatef(rotateZ, 0.0, 0.0, 1.0);

	glutSolidTorus(size * .1, size , 100, 50);
	glPopMatrix();
	//glutWireCube(1);
	//glTranslatef(-(m_Begin.getX() + m_End.getX()) / 2 ,-(m_Begin.getY() + m_End.getY()) / 2, (m_Begin.getZ() + m_End.getZ()) / 2);
	//glRotatef(-75, 1, 0 , 0);
}